Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add message defaults to .ok() and .notOk() #261

Merged
merged 1 commit into from
Apr 1, 2016
Merged

add message defaults to .ok() and .notOk() #261

merged 1 commit into from
Apr 1, 2016

Conversation

paulcpederson
Copy link
Contributor

Just noticed in a reporter that there are really nice test defaults for methods like .equals, but .ok() and .notOk() just say (unnamed assert).

This adds the following default messages:

  • .ok() - "should be truthy"
  • .notOk() - "should be falsey"

Also updates the tests where they are expecting the old default value.

@@ -312,7 +312,7 @@ Test.prototype.notOk
= Test.prototype.notok
= function (value, msg, extra) {
this._assert(!value, {
message : msg,
message : defined(msg, 'should be falsey'),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: falsy shouldn't have an e imo.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also i don't see any tests covering the falsy case

@paulcpederson
Copy link
Contributor Author

@ljharb ok, updated to falsy. None of the tests threw an error when I changed the notOk error message. Does that mean there are currently no tests for notOk?

@ljharb
Copy link
Collaborator

ljharb commented Feb 17, 2016

@paulcpederson that's the conclusion i would also come to. would you mind adding some?

fwiw I really like this change - it doesn't change the API, just makes two of the assertions more useful by default.

@paulcpederson
Copy link
Contributor Author

cool. I think I can figure out how to do that.

@paulcpederson
Copy link
Contributor Author

@ljharb ok I added a new test that just tests all of the defaults. Sorry that took me a bit to figure out the test structure. Testing a testing framework is very meta.

@ljharb
Copy link
Collaborator

ljharb commented Feb 17, 2016

Awesome, this LGTM as a semver-minor change.

Any other collaborators object? If not, I'll merge this in a day or two.

@paulcpederson
Copy link
Contributor Author

@ljharb bump.

Have any other collaborators taken a look?

@ljharb
Copy link
Collaborator

ljharb commented Mar 23, 2016

Thanks for the bump - I'll merge this today or tomorrow.

@ljharb
Copy link
Collaborator

ljharb commented Mar 24, 2016

@paulcpederson actually would you mind rebasing this on the latest master?

@paulcpederson
Copy link
Contributor Author

Not at all.

@ljharb
Copy link
Collaborator

ljharb commented Mar 25, 2016

Thanks, ping me when it's updated and I'll merge it!

@paulcpederson
Copy link
Contributor Author

@ljharb ok, should be rebased now from master thanks for your patience, things got a little crazy today!

@ljharb ljharb merged commit 91b639c into tape-testing:master Apr 1, 2016
ljharb added a commit that referenced this pull request Jun 20, 2016
 - [New] make object-inspect depth configurable for expected/actual (#293)
 - [New] add message defaults to .ok() and .notOk() (#261)
 - [Robustness] be robust against the global `setTimeout` changing (#292)
 - [Deps] update `glob`, `object-inspect`
 - [Dev Deps] update `js-yaml`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants